package org.yeruyi.common.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.List;

/**
 * Author: fuguilong
 * Date: 2017/5/21
 * Version: v1.0
 * Note:
 */

public class TabFragmentPagerAdapter extends FragmentPagerAdapter {

    private List<Fragment> page;
    private List<String> title;

    public TabFragmentPagerAdapter(FragmentManager fm, List<String> title, List<Fragment> page) {
        super(fm);
        this.title = title;
        this.page = page;
    }

    @Override
    public Fragment getItem(int position) {
        return page.get(position);
    }

    @Override
    public int getCount() {
        return page.size();
    }

    //配置标题的方法
    @Override
    public CharSequence getPageTitle(int position) {
        return title.get(position);
    }
}
